package com.example.mybatis.support;

import com.example.mybatis.domain.User;
import com.example.mybatis.factory.impl.DefaultObjectFactory;

import java.util.Date;

public class MyObjectFactory   extends DefaultObjectFactory {
    @Override
    public <T> T newInstance(Class<T> type) {
        if (User.class.equals(type)){
          //特殊处理
            User user = new User();
            user.setCreateTime(new Date());
            return (T) user;
        }
        return super.newInstance(type);
    }
}
